#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char *compress(char *src)
{
	char str[100];
	char* p=str;
	int len=strlen(src);
	int index=0;
	for(int i=0;i<len;)
	{
		int count=1;
		while(i+count<len&&src[i+count]==src[i])
		{
			count++;
		}
		if(count>=3)
		{
			index+=sprintf(&str[index],"%c%d",src[i],count);
		}
		else
		{
			for(int j=0;j<count;j++)
			{
				str[index++]=src[i];
			}
		}
		i+=count;
	}
	return p;
}
int main()
{
	char src[100];
	scanf("%s",src);

	char *ps = compress(src);
	
	puts(ps);
	return 0;
}
